<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ include file="../common/base.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>

<meta http-equiv="X-UA-Compatible" content="IE=10" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>login</title>
<link href="${path }/dist/css/bootstrap.min.css" rel="stylesheet" />
<link href="${path }/dist/css/Buttom.css" rel="stylesheet" />
<link href="${path }/dist/css/flat-ui.css" rel="stylesheet">
<link href='${path }/dist/css/zTreeStyle/zTreeStyle.css'
	rel='stylesheet' />
<link
	href="http://cdn.bootcss.com/font-awesome/4.2.0/css/font-awesome.min.css"
	rel="stylesheet">
<style type="text/css">
.ztree>li {
	float: left;
	display: inline;
	width: 185px;
	height: 100%;
	padding-bottom: 20px;
}
.ztree>li:nth-child(even){
	background-color: #f9f9f9;
}
.ztree span.button.switch{
	display: none;/* 取消树的+/-*/
}
body {
	height: 100%;
}
html {
	height: 100%;
}
.footer{
 	width:100%;
   height:110px; 
   text-align:center; 
   bottom:0px; 
   overflow:hidden; 
   margin:auto 0px auto 0px; 
   position:absolute; 
   z-index:0;}
</style>
</head>
<body>
	<%@include file="../head.jsp" %>
	<div class="panel panel-default">
		<div class="panel-heading" style="background: none;">
			<span class="fui-windows-8"></span> <span>${user.account }的权限</span>
			<button type="button" class="buttons button-caution button-rounded button-tiny"  style="float: right; margin-right: 60px;" onclick="javascript :history.back(-1)">返回</button>


		
		</div>
		<div class="panel-body" style="padding: 0px;">
			<div id='purviewTreeNode' class="ztree"></div>
		</div>
	</div>
	<div class="footer">
	<%@include file="../Footer.jsp" %>
	</div>
	<script src='${path }/dist/js/jquery.min.js'></script>
	<script src='${path }/dist/js/bootstrap.min.js'></script>
	<script src='${path }/dist/js/jquery.ztree.core-3.5.js'></script>
		<script src='${path }/dist/js/jquery.ztree.excheck-3.5.js'></script>
	<script src='${path }/dist/js/jquery.ztree.exedit-3.5.js'></script>

	<script type="text/javascript">
	<!--
		
		var settingPurview = {
			view : {
				selectedMulti : false,//多选
				showLine : false,//不显示链接线
				txtSelectedEnable : false,//不可以选择文字
				showIcon : false,//不显示ico
				dblClickExpand: false,//不允许双击展开关闭节点
				nameIsHTML: true

			},
			async : {
				enable : true,
				url : "${path}/emp/loaduserpurview",
				autoParam : [ "id" ],
				otherParam : {
					"otherParam" : "zTreeAsyncTest"
				},//提交的参数[key：value]
				dataFilter : filter
			},
			callback : {
				beforeClick : beforeClick,
				beforeAsync : beforeAsync,
				onAsyncError : onAsyncError,
				onAsyncSuccess : onAsyncSuccess
			},
			data : {
				simpleData : {
					enable : true,
				}
			},
			
		};
		function filter(treeId, parentNode, childNodes) {
			if (!childNodes)
				return null;
			for (var i = 0, l = childNodes.length; i < l; i++) {
				childNodes[i].name = childNodes[i].name.replace(/\.n/g, '.');
			}
			return childNodes;
		}
		function beforeClick(treeId, treeNode) {
			return true;
		}
		function beforeAsync(treeId, treeNode) {
		//异步加载之前调用
			return true;
		}
		function onAsyncError(event, treeId, treeNode, XMLHttpRequest,
				textStatus, errorThrown) {
			
		}
		function onAsyncSuccess(event, treeId, treeNode, msg) {
			var treeObj = $.fn.zTree.getZTreeObj(treeId);
			var nodes = treeObj.transformToArray(treeObj.getNodes());
			//alert(nodes.length);
			for(var i=0;i<nodes.length;i++){
				//alert(nodes[i].checked==true);
				
				if(nodes[i].checked=="true"||nodes[i].checked==true){
					nodes[i].name="<span style='color:red;margin-right:0px;'>"+nodes[i].name+"</span>";
					treeObj.updateNode(nodes[i]);
				}else{
					nodes[i].name="<s style='color:#777;'>"+nodes[i].name+"</s>";
					treeObj.updateNode(nodes[i]);
				}
			}
			
			
		}
		
		$(document).ready(function() {
			$.fn.zTree.init($("#purviewTreeNode"), settingPurview);
			//$(".footer").bind("change",function(){alert(1);})
		});
	//-->
	</script>
</body>
</html>